﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RAMED
{
    public partial class ModifierDemandeForm : Form

    {
        private Demande_litigieuses dl = new Demande_litigieuses();

        public Demande_litigieuses Dl
        {
            get { return dl; }
            set { dl = value; }
        }

        public ModifierDemandeForm()
        {
            InitializeComponent();
            RAMEDEntities1 context = SingletonContext.GetContext();
            comboBoxane.DataSource = context.Annexe_administratif;
            comboBoxane.DisplayMember = "nom_annexe_administratif";
            comboBoxane.ValueMember = "id_annexe_administratif"; 
           
        }
        public RechercheDemandeForm Recherchedemendeform { get; set; }

        private void s_Click(object sender, EventArgs e)
        {
            RAMEDEntities1 context = SingletonContext.GetContext();
            Demande_litigieuses dl = new Demande_litigieuses();
            dl = context.Demande_litigieuses.Where(d=> d.id_demande_litigieuses == Dl.id_demande_litigieuses).First();
            dl.nmu_doosier = utitlitaire.CasterString(txtNumerodossier.Text);
            dl.erreur = txterrreur.Text;
            dl.CIN = txtCIN.Text;
            dl.id_annexe_administratif = ((Annexe_administratif)comboBoxane.SelectedItem).id_annexe_administratif;
            Recherchedemendeform.mettreAjourFormGridView();
            context.SaveChanges();
            this.Dispose();
        }
        public void InitialiserChamps()
        {
            txtNumerodossier.Text = dl.nmu_doosier.ToString();
            txterrreur.Text = dl.erreur;
            txtCIN.Text = dl.CIN;
            comboBoxane.SelectedValue = dl.Annexe_administratif.id_annexe_administratif; 
        }
        

        private void ModifierDemandeForm_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void Button21_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void btnsuprimerdemande_Click(object sender, EventArgs e)
        {

        }
      
    }
}
